<!DOCTYPE html>
<html> 
    <head>
        <meta charset="utf-8">
        <title></title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="__PUBLIC__/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/css/x-admin.css" media="all">
        <link rel="stylesheet" href="__PUBLIC__/css/page.css" >
        <script src="__PUBLIC__/js/jquery.js"></script>
        <script src="__PUBLIC__/js/laydate/laydate.js"></script>
    </head>
    <script>
        $(document).ready(function(){
            //添加规则信息
            $("#add").click(function(){
                location.href="{:U('Admin/Rule/AuthRule_add')}";
            });         
            //全选函数
            $("#check").click(function(){     
                var checked = $(this).is(":checked"); 
                $("input[name='nid[]']").each(function () {
                    $(this).attr("checked", !$(this).attr("checked"));
                })
            });
            //全选删除
            $("#delall").click(function(){
                  if(delconfirm()){
                      var arrChk=$("input[name='nid[]']:checked");
                      if(arrChk.length>0){
                          $.post("{:U('Admin/Rule/alldel')}",{
                                allid:cheall(),
                                data:Math.random()
                          },function(msg){
                               if(msg.status){
                                   alert(msg.retDesc);
                                   window.location.reload();
                               }else{
                                   alert(msg.retDesc);   
                               }
                          },"json");
                      }else{
                          alert("请选择要删除的记录！");
                      }                	  
                  }
            });

        });

          //全选值
          function cheall(){
                var zhe="";
                $("input[name='nid[]']").each(function () {
                    if ($(this).attr('checked')) {
                        zhe+= $(this).val()+',';
                    }
                });
                return zhe;
          } 
        //删除确认
          function delconfirm(){
            if(window.confirm("请确认是否删除？")){
             return true;
            }
            return false;
          }
    </script>
    <body>
      <div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>管理员管理</cite></a>
              <a><cite>权限分类列表</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
      </div>
        <div class="x-body">
            <xblock><button class="layui-btn layui-btn-danger" id="delall"><i class="layui-icon">&#xe640;</i>批量删除</button><button class="layui-btn" id="add"><i class="layui-icon">&#xe608;</i>添加分类</button><span class="x-right" style="line-height:40px">共有数据：{$count} 条</span></xblock>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th style="width:30px;">
                            <input type="checkbox" name="" value="">
                        </th>
                        <th style="width:30px;">编号</th>
                        <th>权限名称</th>
                        <th>状态</th>
                        <th>时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                    <foreach name="info" item="v">
                    <tr>
                        <td><input type="checkbox" value="{$v.id}" name="id[]"></td>
                        <td>{$v.id}</td>
                        <td>{$v.title}</td>
                        <td><if condition="$v.status eq 1" ><font color='green'>启用中</font><else/><font color='red'>停用</font></if></td>
                        <td>{$v.addtime}</td>
                        <td class="td-manage">
                            <a title="编辑" href="{:U('Admin/Rule/AuthRule_modi',array('nid'=>$v['id']))}" class="ml-5" style="text-decoration:none">
                                <i class="layui-icon">&#xe642;</i>
                            </a>
                            <a title="删除" href="{:U('Admin/Rule/AuthRule_del',array('nid'=>$v['id']))}" style="text-decoration:none">
                                <i class="layui-icon">&#xe640;</i>
                            </a>
                        </td>
                        
                    </tr>
                    </foreach>
                
            </table>
            <div class='page1'>{$page}</div>
        </div>

    </body>
    <script src="__PUBLIC__/lib/layui/layui.js" charset="utf-8"></script>
    <script src="__PUBLIC__/js/x-layui.js" charset="utf-8"></script>
    <script>
    layui.use(['element','layer','form'], function(){
        
      lement = layui.element();//面包导航
      layer = layui.layer;//弹出层
      form = layui.form();
    })    
    </script>
</html>